﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BaseModuleAddEdit.aspx.cs"
    Inherits="BitPortal.Admin.Module.BaseModule.BaseModuleAddEdit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .images-view .x-panel-body
        {
            background: white;
            font: 11px Arial, Helvetica, sans-serif;
        }
        .images-view .thumb
        {
            background: #dddddd;
            padding: 3px;
        }
        .images-view .thumb img
        {
            height: 64px;
        }
        .images-view .thumb-wrap
        {
            float: left;
            margin: 4px;
            margin-right: 0;
            padding: 5px;
            text-align: center;
        }
        .images-view .thumb-wrap span
        {
            display: block;
            overflow: hidden;
            text-align: center;
        }
        
        .images-view .x-view-over
        {
            border: 1px solid #dddddd;
            background: #efefef url(../../Shared/images/row-over.gif) repeat-x left top;
            padding: 4px;
        }
        
        .images-view .x-view-selected
        {
            background: #eff5fb url(../../Shared/images/selected.gif) no-repeat right bottom;
            border: 1px solid #99bbe8;
            padding: 4px;
        }
        .images-view .x-view-selected .thumb
        {
            background: transparent;
        }
        
        .images-view .loading-indicator
        {
            font-size: 11px;
            background-image: url(../../Shared/images/loading.gif);
            background-repeat: no-repeat;
            background-position: left;
            padding-left: 20px;
            margin: 10px;
        }
    </style>
</head>
<body>
    <script type="text/javascript">
        function OpenFileSelecter() {
            window.open('/Admin/FileManager/FileManager.aspx?parentID=<%= TextField1.ClientID %>&path=~/Modules', 'window1', 'width=970,height=650,scrollbars=no');
        }
    </script>
    <script type="text/javascript">
    var prepareData = function (data) {
        data.shortName = Ext.util.Format.ellipsis(data.name, 15);
        data.sizeString = Ext.util.Format.fileSize(data.size);
        data.dateString = data.lastmod.format("m/d/Y g:i a");

        return data;
    };

    var selectionChaged = function (dv, nodes) {
        var l = nodes.length, s = l != 1 ? 's' : '';
        <%=Panel1.ClientID %>.setTitle('Chọn module để cài đặt (Giữ phím \'Ctrl\' để chọn nhiều module) ('+ l +' module chọn)');
    };
    </script>
    <form id="form1" runat="server">
    <div>
        <ext:ResourceManager ID="ResourceManager1" runat="server">
        </ext:ResourceManager>
        <ext:Store runat="server" ID="Store1">
            <Reader>
                <ext:JsonReader IDProperty="Url">
                    <Fields>
                        <ext:RecordField Name="Name" Type="String" />
                        <ext:RecordField Name="Url" Type="String" />
                        <ext:RecordField Name="Icon" Type="String" />
                        <ext:RecordField Name="Code" Type="String" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
        <ext:Panel ID="Panel1" runat="server" Cls="images-view" Frame="true" AutoHeight="true"
            Width="760" Collapsible="true" Layout="Fit" Title="Chọn module để cài đặt (Giữ phím 'Ctrl' để chọn nhiều module) (0 module chọn)">
            <Buttons>
                <ext:Button ID="Button2" runat="server" Text="Cài đặt" Icon="CogAdd">
                    <DirectEvents>
                        <Click OnEvent="btnSetup_Click">
                            <EventMask ShowMask="true" Msg="Waiting..." MinDelay="500" />
                        </Click>
                    </DirectEvents>
                </ext:Button>
            </Buttons>
            <Items>
                <ext:DataView ID="ImageView" runat="server" StoreID="Store1" AutoHeight="true" MultiSelect="true"
                    OverClass="x-view-over" ItemSelector="div.thumb-wrap" EmptyText="No images to display">
                    <Template ID="Template1" runat="server">
                        <Html>
                            <tpl for=".">
								<div class="thumb-wrap" id="{Code}">
									<div class="thumb"><img src="{Icon}" title="{Name}"></div>
									<span class="x-editable">{Name}</span>
								</div>
							</tpl>
                            <div class="x-clear"></div>
                        </Html>
                    </Template>
                    <Listeners>
                        <SelectionChange Fn="selectionChaged" />
                    </Listeners>
                </ext:DataView>
            </Items>
        </ext:Panel>
        <ext:Panel ID="Panel3" runat="server" Title="Chọn module" Padding="10" Layout="HBoxLayout"
            Height="100" Width="700" Hidden="true">
            <Content>
                <ext:TextField ID="TextField1" runat="server" Width="350">
                </ext:TextField>
                <ext:Button ID="Button1" runat="server" Text="Chọn module" Icon="FolderExplore">
                    <Listeners>
                        <Click Handler="OpenFileSelecter()" />
                    </Listeners>
                </ext:Button>
                <ext:Button ID="btnSetup" runat="server" Text="Cài đặt" Icon="CogAdd">
                    <DirectEvents>
                        <Click OnEvent="btnSetup_Click">
                            <EventMask ShowMask="true" Msg="Waiting..." MinDelay="500" />
                        </Click>
                    </DirectEvents>
                </ext:Button>
            </Content>
        </ext:Panel>
        <ext:Panel ID="Panel2" runat="server" Title="Cấu hình module" Layout="FormLayout"
            Padding="10" ButtonAlign="Center" AutoHeight="true" Width="700" Hidden="true">
            <Items>
                <ext:Hidden ID="txtID" runat="server">
                </ext:Hidden>
                <ext:TextField ID="txtName" runat="server" FieldLabel="Tên module" AnchorHorizontal="50%"
                    Enabled="false">
                </ext:TextField>
                <ext:TextArea ID="txtDescription" runat="server" FieldLabel="Mô tả" AnchorHorizontal="100%">
                </ext:TextArea>
                <ext:Panel ID="Panel5" runat="server" Title="Cấu hình thuộc tính" AutoHeight="true"
                    Padding="10" LabelAlign="Left" Layout="FormLayout" AnchorHorizontal="100%" FormGroup="true">
                    <Content>
                    </Content>
                </ext:Panel>
            </Items>
            <Buttons>
                <ext:Button ID="btnUpdate" runat="server" Text="Cập nhật">
                    <DirectEvents>
                        <Click OnEvent="btnUpdate_Click">
                            <EventMask ShowMask="true" Msg="Waiting..." MinDelay="500" />
                        </Click>
                    </DirectEvents>
                </ext:Button>
                <ext:Button ID="btnCancel" runat="server" Text="Bỏ qua">
                    <Listeners>
                        <Click Handler="parent.Ext.WindowMgr.getActive().hide();" />
                    </Listeners>
                </ext:Button>
            </Buttons>
        </ext:Panel>
    </div>
    </form>
</body>
</html>
